<template>
	<view class="mySetting">
		<view class="" style="text-align: center;font-size: 22rpx;margin-bottom: 20rpx;">
			此投诉为本小程序自有投诉渠道，非微信官方投诉渠道
		</view>
		<view class="center-box">
			<view class="item-box">
				<view class="name">
					姓名
				</view>
				<view class="right-box">
					<input type="text" v-model="name" style="width: 100%;padding-left: 20rpx;" placeholder="请输入姓名">
				</view>
			</view>
			<view class="item-box">
				<view class="name">
					联系方式
				</view>
				<view class="right-box">
					<input type="text" v-model="phone" style="width: 100%;padding-left: 20rpx;" placeholder="请输入联系方式">
				</view>
			</view>
			<view class="text-box">
				<textarea style="width: 100%;height: 100%;" placeholder-style="font-size: 26rpx;color: #A7A7A7;" cols="30" rows="10" v-model="text" placeholder="在此处留下您对微湖游小程序的投诉建议,对您带来的影响和不便我们表示深深的歉意!"></textarea>
			</view>
		</view>
		<view class="out-box">
			<view class="bnt-box" @click="addBnt">
				提交
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import {
		baseOssUrl
	} from '@/common/settings';
	export default {
		//登录状态
		computed: mapState(['isLogin']),
		data() {
			return {
				userInfo: {},
				baseOssUrl: baseOssUrl,
				text:'',
				phone:'',
				name:''
			}
		},
		onLoad() {

		},
		methods: {
			...mapMutations(['login', 'logout']),
			addBnt() {
				if(!this.name) {
					uni.showToast({
						icon: 'none',
						title: '请输入收货人姓名!',
						duration: 2000
					});
					return
				}
				if(!this.phone) {
					uni.showToast({
						icon: 'none',
						title: '请输入手机号!',
						duration: 2000
					});
					return
				}
				if(this.phone.lenght < 11) {
					uni.showToast({
						icon: 'none',
						title: '请输入正确的手机号!',
						duration: 2000
					});
					return
				}
				if(!this.text) {
					uni.showToast({
						icon: 'none',
						title: '请输入建议!',
						duration: 2000
					});
					return
				}
				this.$http.post(this.$httpApi.tsjySave + "?uId=" + uni.getStorageSync('userinfo').userId + "&phone=" + this.phone + "&name=" + this.name + "&text=" + this.text).then(res => {
					if (res.code == 0) {
						uni.showToast({
							title: '提交成功！',
							duration: 2000
						});
						setTimeout(res=>{
							uni.navigateBack(-1)
						},1000)
					}
				})
				
			}
		}
	}
</script>
<style>   page {     background: #EFEFEF;  } </style>
<style lang="scss" scoped>
	.mySetting {
		height: 100%;
		padding: 24rpx 32rpx 32rpx 32rpx;
		.center-box {
			padding: 33rpx 24rpx 30rpx 24rpx;
			border-radius: 8rpx ;
			background-color: #ffffff;
			.item-box {
				display: flex;
				align-items: center;
				margin-bottom: 18rpx;
				.name {
					font-size: 28rpx;
					color: #1D1D1D;
				}
				.right-box {
					display: flex;
					align-items: center;
					margin-left: auto;
					width: 502rpx;
					height: 64rpx;
					background: #F5F5F5;
					border-radius: 8rpx;
				}
			}
			.text-box {
				padding: 24rpx;
				margin-top: 6rpx;
				height: 368rpx;
				background: #F5F5F5;
				border-radius: 8rpx;
			}
		}
		.out-box {
			margin-top: 90rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			.bnt-box {
				width: 686rpx;
				height: 72rpx;
				background: #35743D;
				border-radius: 50rpx;
				text-align: center;
				line-height: 72rpx;
				font-weight: 500;
				color: #FFFFFF;
			}
		}
	}
</style>
